{include file="public/header" /}
<span class="layui-breadcrumb">
  <a href="{:url('Blog/index')}?nav=blog-bloglist">分类</a>
  <a><cite>编辑-{$one['cname']}</cite></a>
</span>
<style> 
.layui-form-label{width:200px;}
.layui-form-item .layui-input-block{margin-left:230px;}
</style>
<div class="layui-fluid">
    <div class="layui-card">
      <form class="layui-form" id="product_form" action="" style='padding:10px'>

        <div class="layui-form-item">
              <div class="layui-input-block" style="color: red;">
                  以下两个输入的内容仅允许输入一个，第一个是以程序来创造页面，第二个是自定义的网页
              </div>
          </div>
        <div class="layui-form-item">
              <label class="layui-form-label">程序页面的名称</label>
              <div class="layui-input-block">
                 <input type="text" id="view_name" name="view_name" lay-verify="title" autocomplete="off" value="{$dan_view['view_name']}" class="layui-input">
                 <span style="color: red;">不能有空格和符号，单词链接处必须是下划线</span>
              </div>
          </div>


        <div class="layui-form-item">
              <label class="layui-form-label">自定义页面内容</label>
              <div class="layui-input-block">
                <textarea id="content" name="content" style="width:100%;">{$dan_view['content']}</textarea>
              </div>
          </div>



        <div class="layui-form-item">
          <label class="layui-form-label"></label>
          <div class="layui-input-block">
             <button type='button' class="layui-btn layui-btn-normal" onclick="tijiao({$one['id']})">确定</button>
          </div>
        </div>
         <div class="layui-form-item">
              <div class="layui-input-block">
                页面链接 : <a style="color: #36648a" href="/{:get_class_uplower_url($one['id'])}" target='_blank'>{$one['cname']}</a>
              </div>
          </div>

    </form>
    </div>
</div>
{include file="/public/footer" /}
<script charset="utf-8" src="/static/kindeditor/kindeditor-all.js"></script>
<script charset="utf-8" src="/static/kindeditor/lang/zh-CN.js"></script>
<script>

  KindEditor.ready(function(K) {
    window.editor=K.create('#content',{'items':['source', '|', 'undo', 'redo', '|','selectall', 'preview', 'print', 'code', 'cut', 'copy', 'paste','plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright','justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript','superscript', 'clearhtml', 'quickformat', '|','formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold','italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image', 'media', 'insertfile', 'table', 'hr', 'emoticons', 'baidumap', 'pagebreak','anchor', 'link', 'unlink','|', 'fullscreen'],'uploadJson':"{:url('index/Oos/upload_classdes')}",afterCreate : function() { this.sync(); },afterBlur: function(){this.sync();}
    });

  })

 function tijiao(id){
    layer.load();
    var view_name=$.trim($("input[name='view_name']").val());
    var content=$.trim($("textarea[name='content']").val());

    if(view_name!='' && content!=''){
      layer.closeAll();
      layer.msg('只允许输入一个');
      return false;
    }

    if(view_name=='' && content==''){
      layer.closeAll();
      layer.msg('请选择一个输入');
      return false;
    }

    $.post("{:url('Classify/dan')}",{id:id,
      view_name:view_name,
      content:content
    },function(res){
      if(res.status=='0'){
        layer.closeAll('loading');
        layer.msg(res.msg);
      }
      if(res.status=='1'){
        layer.msg(res.msg,{time: 500 },
        function(){
          layer.closeAll();
          location.href=location.href;
        });
      }
    })
 }
</script>
